package com.hycat.mail.ware.dao;

import com.hycat.mail.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;


/**
 * 商品库存
 * 
 * @author lzhycat
 * @email 2680628835@qq.com
 * @date 2022-07-16 20:30:08
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    //根据skuId查具体库存量
    Long stockDetails(@Param(value = "skuId") Long skuId);

    //根据skuId查那些仓库有库存
    List<WareSkuEntity> getHasStock(@Param(value = "skuId") Long skuId);

    //锁定库存
    void lockStock(@Param(value = "id") Long id,
                   @Param(value = "count") Integer count);

    //释放库存
    void unLockStock(@Param(value = "id") Long id,
                     @Param(value = "count") Integer count);
}
